ModesHint = "|Each view can be set to one of three rendering modes :\n\nWireframe : all polygons are drawn as lines, entities as points, etc.\n\nSolid : each polygon is drawn in a single, solid color.\n\nTextured : polygon and models are displayed with their texture."
class BaseLayout:
"An abstract base class for Map and Model Editor screen layouts."
CurrentOpenGLOwner = "NEVER"
def __init__(self):
# debug("Creation of layout '%s'" % self.__class__.__name__)
self.clearrefs()
def clearrefs(self):
self.rotateviews = self.views = []
self.baseviews = []
self.sblinks = [] # list of tuples (0 or 1, sourceview, 0 or 1, destview)
self.oldsblinks = None # where 0 means horizontal and 1 means vertical
self.explorer = None
self.mpp = None
self.buttons = {}
self.toolbars = {}
self.leftpanel = None
self.full3DFX = None
self.hintcontrol = None
self.hinttext = ""
self.compass = None
# def __del__(self):
# debug("Destruction of layout '%s'" % self.__class__.__name__)
def destroyscreen(self, form):
"Closes everything on the screen and clears all references."
try:
setup = quarkx.setupsubset(self.MODE, "Layouts")
config = setup.findshortname(self.shortname)
if config is None:
config = quarkx.newobj(self.shortname+":config")
setup.appenditem(config)
self.writeconfig(config)
writetoolbars(self, config)
self.releaseOpenGL(1)
finally:
for c in form.floatings(): c.close()
for c in form.mainpanel.controls(): c.close()
for c in form.toolbars(): c.close()
form.mainpanel.sections = ((),())
if self.explorer != None: self.explorer.clear()
if self.mpp != None: self.mpp.clear()
self.clearrefs()
del self.editor
def setupchanged(self, level):
"Reads setup-dependant information for the layout."
# Update the map view's display limit, to know what should
# be normal or grayed out
#
self.setupdepth(view)
#
# Scroll the views whose position are linked together
#
for ifrom, linkfrom, ito, linkto in self.sblinks:
if linkfrom is view:
pos = view.scrollbars[ifrom][0]
if ito: # if the dest. view is to be scrolled vertically
linkto.scrollto(None, pos)
else:
linkto.scrollto(pos, None)
def getlayoutmenu(self, text="level"):
"Builds a default Layout menu (may be overridden)."
modhint = ModesHint + "\n\nThe commands in this menu lets you change the mode for all views at once. To set the mode of a single view, right-click on it.|intro.mapeditor.menu.html#layoutmenu"
New3D = qmenu.item("New &3D window", self.new3Dwindow, "|New 3D window:\n\nThis will create a new free-floating 3D edit window. ", infobaselink)
NewOGL = qmenu.item("OpenGL view", self.toggleOpenGLwindow, "|OpenGL 3D view:\n\nThis does the same as the previous command\n'New 3D-window' but the 3D viewer uses the OpenGL standard 3D graphic library. ", infobaselink)
NewF3D = qmenu.item("Full 3D view", self.full3Dclick, "|Full 3D view:\n\nThis does the same as the 'New 3D-window' command but in full screen mode.", infobaselink)
cliphint = "|While you edit your "+text+", some parts of it may be visible on one view but not on the others. Such parts are considered to be 'out of view', and these commands control how they are displayed :\n\n'Show whole "+text+"': no out-of-view masking\n'Gray out of view': grayed out (default)\n'Hide out of view': simply hidden"
DrM2 = qmenu.item("&Gray out of view", self.setdrawmode, cliphint, infobaselink)
DrM2.mode = DM_GRAYOOV
DrM3 = qmenu.item("&Hide out of view", self.setdrawmode, cliphint, infobaselink)
DrM3.mode = DM_HIDEOOV
PanelRight = qmenu.item("Panel at &right", self.panelatright, "|Panel at right:\n\nThis will move the main panel to the right side of your screen. Unselecting this function will move it back to the left side.", infobaselink)
#
# NOTE: this menu is accessed by position in the function "layoutmenuclick"
"Builds the multi-pages panel (usually bottom left)."
ico_maped=ico_dict['ico_maped']
self.explorer = panel.newexplorer()
self.explorer.flags = EF_AUTOFOCUS
self.explorer.hint = "Data displays||Data displays:\n\nThese are the various displays to help you build and organize your map.\n\nThere are five specific displays, they are:\n\nTree-view (hierarchy-view)\nSpecifics/Args-view\nPolyhedron-view\nFace-view\n3D-view\n\nFor a detailed description and use of these displays, see the infobase documents.|intro.mapeditor.dataforms.html"
page0 = qtoolbar.button(None, "Tree-view (hierarchy-view)||Tree-view (hierarchy-view):\n\nThis view displays a list of everything in your map : entities, polyhedrons, groups, etc.\n\n You should consider it as the best way to organize your map so that you can easily find what you are looking for.\n\nUse groups (the button above) to organize your map.\nFor more information about the available object types, see the tutorials.\n\nAlso see the infobase for a more detailed description and use of this view display.", ico_maped, 8, "Tree-view (hierarchy-view)", infobaselink='intro.mapeditor.dataforms.html#treeview')
page0.pc = [self.explorer]
plist, mppages = self.bs_additionalpages(panel)
plist.insert(0, page0)
for f in mppages:
mppg = f(self, panel)
plist.append(mppg.button())
count = 0
for btn in plist:
count = count + 1
if count<=9:
# See also qbaseeditor.BaseEditor.initquickkeys
#
# Split up the hint, into its components delimited by a "|".
hintstrings = btn.hint.split("|");
# Then alter the first flyover-hint, suffix with a "(keyboard shortcut..)" string.
hintstrings[0] = "%s\n(keyboard shortcut: '%d')" % (hintstrings[0], count) # To indicate what is a shortcut-key
# Put it all together again as a string, with the "|" delimiter
self.mpp.lock = qtoolbar.button(maptogglebtn, "lock the current page||When this button is activated, QuArK no longer automatically switches between the pages when you select or unselect objects.", ico_maped, 9)
NewItem = [qtoolbar.button(self.NewItem1Click, "New item||New item:\n\nThis window contains all objects thats possible to use in the map-views and dataform-display.|intro.mapeditor.misctools.html#newmapitem", ico_objects, iiNewFolder)]
Undo = qtoolbar.macrobtn("MURD", "Multiple undo/redo||Multiple undo/redo:\n\nThe icon will open up the undo/redo display. |intro.mapeditor.misctools.html#undoredo", ico_maped, 6)
NewGroup = qtoolbar.button(self.editor.editcmdclick, "New group||New group:\n\nCreates a new group in the tree-view, where you can place other objects in, so they are neatly grouped together.|intro.mapeditor.misctools.html#newgroup", ico_maped, 16)